<template>
    <a-layout-sider width="200" style="background: #fff">
      <a-menu
          v-model:selectedKeys="selectedKeys"
          v-model:openKeys="openKeys"
          mode="inline"
          :style="{ height: '100%', borderRight: 0 }"
      >
        <a-menu-item key="/welcome">
          <router-link to="/welcome">
            <coffee-outlined /> &nbsp; 欢迎
          </router-link>
        </a-menu-item>
        <a-menu-item key="/passenger">
          <router-link to="/passenger">
            <user-outlined /> &nbsp; 乘车人管理
          </router-link>
        </a-menu-item>
        <a-menu-item key="/ticket">
          <router-link to="/ticket">
            <border-outer-outlined /> &nbsp; 余票查询
          </router-link>
        </a-menu-item>
        <a-menu-item key="/my-ticket">
          <router-link to="/my-ticket">
            <idcard-outlined /> &nbsp; 我的车票
          </router-link>
        </a-menu-item>
        <a-menu-item key="/seat">
          <router-link to="/seat">
            <usergroup-add-outlined /> &nbsp; 座位销售图
          </router-link>
        </a-menu-item>
        <a-menu-item key="/admin">
          <router-link to="/admin">
            <desktop-outlined /> &nbsp; 关于控台管理
          </router-link>
        </a-menu-item>
      </a-menu>
    </a-layout-sider>

</template>

<script>
import {ref} from "vue";

export default {
  name: 'the-sider',
  props: {
    msg: String
  },
}
</script>

<script setup>
import {watch} from "vue";
import router from "@/router";

const openKeys = ref(['sub1']);

const selectedKeys = ref([]);
watch(() => router.currentRoute.value.path, (newValue) => {
  console.log('watch', newValue);
  selectedKeys.value = [];
  selectedKeys.value.push(newValue);
}, {immediate: true});
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.logo {
  float: left;
  width: 120px;
  height: 31px;
  margin: 16px 24px 16px 0;
  background: rgba(255, 255, 255, 0.3);
}

.site-layout-background {
  background: #fff;
}
</style>
